const app = getApp()
Component({
  properties: {
    tab: String
  },
  observers:{ //监听数据的更改
    "tab"(data){
      this.data.tab = data
    }
  },
  externalClasses: ['my-class'],
  methods: {
    data: {
      tab: ''
    },
    onTab: function (e) {
        console.log(e);
      wx.switchTab({
        url: '/pages/' + e.currentTarget.dataset.tab + '/' + e.currentTarget.dataset.tab
      })
    }
  }
})